home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
Libraries
/
SAT 2.3b4
/
Demo ƒ
/
Collision demo ƒ
/
sMrEgghead.p
< prev
Wrap
Text File
|
1995-01-29
|
994b
|
46 lines
{ Player sprite for SATcollision }
unit sMrEgghead;
interface
uses
{$IFC UNDEFINED THINK_PASCAL}
Types, Quickdraw, Events,
{$ENDC}
SAT;
var
mrEggheadFaces: array[0..3] of FacePtr;
procedure InitMrEgghead;
procedure SetupMrEgghead (me: SpritePtr);
procedure HandleMrEgghead (me: SpritePtr);
implementation
procedure InitMrEgghead;
var
i: integer;
begin
for i := 0 to 3 do
mrEggheadFaces[i] := SATGetFace(128 + i);
end;
procedure SetupMrEgghead (me: SpritePtr);
begin
{me^.mode := 0; Unnecessary - it is always initialized to 0 by SAT.}
me^.kind := 1; {"Friend" kind - positive so it can collide with apples, which have negative kind.}
SetRect(me^.hotRect, 0, 0, 32, 32); {Set the "hot" rectange, for collisions}
me^.task := @HandleMrEgghead; {Must have a handling routine}
end;
procedure HandleMrEgghead (me: SpritePtr);
begin
GetMouse(me^.position);
me^.mode := (me^.mode + 1) mod 4;
me^.face := mrEggheadFaces[me^.mode];
end;
end.